#include<iostream>
#include<math.h>
using namespace std;
double ac(float x)
{
    double s=0.0,p=0.0;
    int n=1,t=1,m=1;
    while(p<x)
    {
        p=1.0/t;
        s+=m*p;
        m=-m;
        t=t+2;
        n=n+1;
    }
    return s;
}
int main()
{
    float x;
    cout<<"请输入需要的精度：";
    cin>>x;
    cout<<"π="<<4*ac(x)<<endl;
    return 0;
}
